package com.gsh.study.controller;

import com.gsh.study.entity.Work;
import com.gsh.study.service.intf.WorkService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

/**
 * @author GSh
 * @packageName:com.gsh.study.controller
 * @className:WorkController
 * @description
 * @create 2021-09-29 15:31
 */
@Data
@Controller
@RequestMapping("/api/work/")
public class WorkController {
    @Autowired
    private WorkService service;

    @RequestMapping(value = "add",method ={RequestMethod.POST})
    @ResponseBody
    public int add(Work work) {
        return service.add(work);
    }
    @RequestMapping(value = "all", method = {RequestMethod.GET})
    @ResponseBody
    public List<Work> selectAll() {
        return service.selectAllWork();
    }
}
